package com.dongline.test.huizongliuliang;


import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class FlowMapper extends Mapper<LongWritable,Text, Text,FlowWritable> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line=value.toString();
        String [] strs=line.split("\t");
        String phone=strs[1];
        long upflow=Long.parseLong(strs[strs.length-2]);
        long downflow=Long.parseLong(strs[strs.length-3]);

        context.write(new Text(phone),new FlowWritable(upflow,downflow));
    }
}
